package excercise;

import java.util.Scanner;

public class ex_07 {

	public static void main(String[] args) {

		//Q26
		int num1, num2;
		num1 = (int) (Math.random() * 100) + 1;

		Scanner sc = new Scanner(System.in);
    
		do {

			System.out.println("입력!");

			num2 = sc.nextInt();

			if (num1 > num2)
				System.out.println("추측한 숫자가 작습니다.");

			else if (num1 < num2)
				System.out.println("추측한 숫자가 큽니다.");
			else{
				System.out.println("빙고! 숫자를 맞췄습니다.");
			break;
			}
		} while (num1!=num2);

		
		
		//Q23
		
		int mylotto[]=new int [4];
		int[] comlotto= new int[4];
		int match =0;   //일치횟수
		 
		
		//comlotto =(int) (Math.random()*1000)+1;
		 //0.123456789 : 1000=> 123.456789=>123
		 //0.000123456 : 1000 => 0.123456 => 1
		
		/*comlotto [1] = (int)(Math.random()*10);
		comlotto [2] = (int)(Math.random()*10);
		comlotto [3] = (int)(Math.random()*10);*/
		
		//컴퓨터 복권 3자리 생성
		for (int i =1;i<comlotto.length;++i)
			 comlotto[i] = (int)(Math.random()*10);
		
		
		
		
		//사용자로부터 3자리 입력받기
		
		sc = new Scanner(System.in);
		for(int i = 1;i < mylotto.length;++i)
		{
			System.out.println(i+"번째문자를 입력하세요!");
			mylotto [i] =sc.nextInt();
		}
		
		//비교
		//123:231,312,132,321,213
		if(mylotto[1]==comlotto[1]
				||mylotto[1]==comlotto[2]
						||mylotto[1]==comlotto[3])++match;
		if(mylotto[2]==comlotto[1]
				||mylotto[2]==comlotto[2]
						||mylotto[2]==comlotto[3])++match;
		if(mylotto[3]==comlotto[1]
				||mylotto[3]==comlotto[2]
						||mylotto[3]==comlotto[3])++match;
		//일치여부에 따른 상금 부여		
		if (match==1)
				System.out.println("3등당첨 1000원!");
		else	if (match==2)
						System.out.println("2등당첨 10000원!");
		else	if (match==3)
						System.out.println("1등당첨 100만원!");
		else
			System.out.println("꽝!!!!!");
		
		System.out.println("추첨번호");
		for (int i=1; i<+3;++i)
		System.out.println(comlotto[i]+"\t");
		
		System.out.println("\n 복권번호");
		for (int i=1; i<+3;++i)
		System.out.println(comlotto[i]+"/t");
		
		
		
		//Q24
		
		System.out.println("입력하세요");
		
		int b;
		b= sc.nextInt();
		
		b=(int) (Math.random() * 9) + 1;
		for(int a=1;a<=9;++a)
			System.out.println(b+"x"+a+"="+(a*b));
			
		
	}

}
